/*
*	Copyright (C) 2014  Julio Montes, Mario Carrillo
*	
*	Julio Montes e-mail: imc.coder@gmail.com 
*
*	Mario Carrillo e-mail: mario_90ago@live.com.mx
*
*	BSD 3-Clause License
*/

#ifndef SDK_PLUGINMGR_H
#define SDK_PLUGINMGR_H

#include <wx/wx.h>
#include <vector>

#include "sdk/include/mgr.h"

namespace sdk
{
    class Plugin;

    typedef struct pluginData
    {
        size_t priority;
        bool loaded;
        Plugin *plugin;
        wxString name;
        wxString library;
        wxArrayString dependencies;
    }pluginData;

    class PluginManager : public sdk::Mgr<PluginManager>
    {
        friend class sdk::Mgr<PluginManager>;
    public:
        const std::vector<pluginData> &GetPlugins() const;
        bool LoadPlugins();
    protected:
    private:
        PluginManager();
        virtual ~PluginManager();
        void LoadLibraries();
        pluginData *FindPlugin( const wxString &name );
        bool CalculatePriority( pluginData *plugin );
        bool CheckDependencies( const pluginData &plugin );

        std::vector<pluginData> m_vectorPlugins;
    };
}

#endif // SDK_PLUGINMANAGER_H
